package org.openstack.service.hypervisor;

import org.openstack.api.hypervisor.HypervisorService;
import org.openstack4j.api.compute.ComputeService;
import org.openstack4j.model.compute.ext.Hypervisor;
import org.openstack4j.model.compute.ext.HypervisorStatistics;
import org.openstack4j.openstack.compute.internal.ComputeServiceImpl;

import java.util.List;

/**
 * Created by jiyun on 2017/8/28.
 */
public class HypervisorServiceImpl implements HypervisorService {

    private static ComputeService service = new ComputeServiceImpl();

    /**
     * 列出计算节点
     *
     * @return 计算节点列表
     */
    @Override
    public List<? extends Hypervisor> getHypervisors() {
        return service.hypervisors().list();
    }

    /**
     * 获取所有计算节点总数据
     * 例如：计算节点个数、总磁盘空间、内存空间、虚拟CPU数量等。
     *
     * @return 集合数据
     */
    @Override
    public HypervisorStatistics getTotalStatistics() {
        return service.hypervisors().statistics();
    }
}
